
<script type="text/javascript" src="<?=base_url('assets/js/users.js')?>"></script>

<div id="myModal" class="modal hide fade" style="display: block; ">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
      <h3>
	<?=lang('user.title')?>
	<i id="insert_icon" aria-hidden="true" class="icon-plus" style="margin-top: 6px; color: #5bb75b; display: none;"></i>  
	<i id="delete_icon" aria-hidden="true" class="icon-minus" style="margin-top: 6px; color: #bd362f; display: none;"></i>
	<i id="inform_icon" aria-hidden="true" class="icon-info-circle" style="margin-top: 6px; color: #24A0DA; display: none;"></i>
	<i id="update_icon" aria-hidden="true" class="icon-move-horizontal-alt2" style="margin-top: 6px; color: #f89406; display: none;"></i>
      </h3>
    </div>
    <div class="modal-body">
      <div id="error_msj" class="alert" style="display: none">Mensaje de error.</div>
      <table>
        <input type="hidden" id="id_usuario">
	<input type="hidden" id="operation">
        <tr>
            <th style="text-align: right"><?=lang('user.lastname')?></th>
            <td>&nbsp;&nbsp;<input name="apellido" id="apellido" type="text" class="input-medim" placeholder="<?=lang('user.lastname')?>" maxlength="50"></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <div style="color: red" id="apellido_error"></div>
            </td>
        </tr>
        <tr>
            <th style="text-align: right"><?=lang('user.name')?></th>
            <td>&nbsp;&nbsp;<input name="nombre" id="nombre" type="text" class="input-medim" placeholder="<?=lang('user.name')?>"></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <div style="color: red" id="nombre_error"></div>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <div style="color: red" id="dni_error"></div>
            </td>
        </tr>
        <tr>
            <th style="text-align: right"><?=lang('user.user')?></th>
            <td>&nbsp;&nbsp;<input name="nick" id="nick" type="text" class="input-medim" placeholder="<?=lang('user.user')?>"></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <div style="color: red" id="nick_error"></div>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <div style="color: red" id="domicilio_error"></div>
            </td>
        </tr>
        <tr>
            <th style="text-align: right"><?=lang('user.email')?></th>
            <td>&nbsp;&nbsp;<input name="email" id="email" type="text" class="input-medim" placeholder="<?=lang('user.email')?>"></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <div style="color: red" id="email_error"></div>
            </td>
        </tr>
        <tr>
            <th style="text-align: right"><?=lang('user.pass')?></th>
            <td>&nbsp;&nbsp;<input name="pass" id="pass" type="password" class="input-medim" placeholder="<?=lang('user.pass')?>"></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <div style="color: red" id="pass_error"><?php echo form_error('pass'); ?></div>
            </td>
        </tr>
        <tr>
            <th style="text-align: right"><?=lang('user.passC')?></th>
            <td>&nbsp;&nbsp;<input name="pass2" id="pass2" type="password" class="input-medim" placeholder="<?=lang('user.passC')?>"></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center">
                <div style="color: red" id="pass2_error"></div>
            </td>
        </tr>
        <tr>
            <th style="text-align: right"><?=lang('user.group')?></th>
            <td>&nbsp;
                  <select class="span3" id="grupo" name="grupo">
                    <?php
                    foreach($groups as $g)
                    {
                        echo '<option value="'.$g['gpoId'].'">'.$g['gpoDescription'].'</option>';
                    }
                    ?>
                  </select>
            </td>
        </tr>
	<tr>
            <th style="text-align: right"><?=lang('user.type')?></th>
            <td>&nbsp;
		<select class="span3" id="tipo" name="tipo">
                        <option value="0">Administrador</option>';
			<option value="1" selected="selected">Usuario</option>';
                  </select>
	    </td>
        </tr>
	<tr>
            <th style="text-align: right"><?=lang('user.status')?></th>
            <td>&nbsp;
		<select class="span3" id="estado" name="estado">
                        <option value="AC" selected="selected">Activo</option>';
			<option value="IN">Inactivo</option>';
                  </select>
	    </td>
        </tr>
      </table>
    </div>
    <div class="modal-footer">
      <a href="#" class="btn" data-dismiss="modal" id="btnCancelar"><?=lang('button.close')?></a>
      <a href="#" class="btn btn-primary" id="btnAceptar"><?=lang('button.ok')?></a>
    </div> 
</div>
        <!-- -->



<div class="container" id="containerDiv">
	<div class="row">
		<div class="span1">
		    
		    <button class="btn btn-success" data-toggle="modal" id="btnNewUser" >
			<?=lang('user.add')?>
		    </button>
			    
		</div>
	</div>
	<div class="row">
	    <div class="span12">
		<table class="table table-hover" width="100%">
		    <thead>
		    <tr>
			<th style="text-align: center"><?=lang('user.name')?></th>
			<th style="text-align: center"><?=lang('user.user')?></th>
			<th style="text-align: center"><?=lang('user.email')?></th>
			<th style="text-align: center"><?=lang('user.status')?></th>
			<th style="text-align: center"><?=lang('user.update')?></th>
			<th style="text-align: center"><?=lang('user.delete')?></th>
			<th style="text-align: center"><?=lang('user.see')?></th>
		    </tr>
		    </thead>
		    <tbody>
		    <?php
		    if($users != null)
		    {
			foreach($users as $u)
			{
			    echo '<tr>';
			    echo '<td>'.$u['usrApellido'].' '.$u['usrNombre'].'</td>';
			    echo '<td>'.$u['usrNick'].'</td>';
			    echo '<td>'.$u['usrCorreo'].'</td>';
			    echo '<td style="text-align: center">'.(($u['usrEstado'] == "AC") ? "Activo" : "Inactivo").'</td>';
			    echo '<td style="text-align: center" width="70">
					<i aria-hidden="true" class="icon-pencil" onClick="Get_Data('.$u['usrId'].',\'u\')" style="cursor: pointer;"></i>
				</td>';
			    echo '<td style="text-align: center" width="70">
					<i aria-hidden="true" class="icon-remove" onClick="Get_Data('.$u['usrId'].',\'d\')" style="cursor: pointer;"></i>
				</td>';
			    echo '<td style="text-align: center" width="70">
					<i aria-hidden="true" class=" icon-search" onClick="Get_Data('.$u['usrId'].',\'s\')" style="cursor: pointer;"></i>
				</td>';
			    echo '</tr>';
			}
		    }
		    ?>
		    </tbody>
		</table>
		
	
	    </div>
	</div>
</div>